Skip to content

Add AI agreement creation assistant#85

Open
DavisVT wants to merge 5 commits into
Thalos-Infrastructure:mainfrom
DavisVT:feature/ai-agreement-assistant
Open

Add AI agreement creation assistant#85
DavisVT wants to merge 5 commits into
Thalos-Infrastructure:mainfrom
DavisVT:feature/ai-agreement-assistant

Conversation

@DavisVT

@DavisVT DavisVT commented Jun 21, 2026

Copy link
Copy Markdown
  • Create AI Agreement Assistant component
  • Add server API route for AI draft generation
  • Add 'Create with AI' buttons to Personal and Business dashboards
  • Implement draft pre-filling for existing agreement creation forms

closes #16

- Create AI Agreement Assistant component
- Add server API route for AI draft generation
- Add 'Create with AI' buttons to Personal and Business dashboards
- Implement draft pre-filling for existing agreement creation forms
@vercel

vercel Bot commented Jun 21, 2026

Copy link
Copy Markdown
Contributor

@DavisVT is attempting to deploy a commit to the ManuelJG's projects Team on Vercel.

A member of the Team first needs to authorize it.

@Kalchaqui

Copy link
Copy Markdown
Contributor

Thanks @DavisVT for the AI assistant UI scaffolding on personal and business dashboards.

I'm not merging PR #85 yet. Main blocker: /api/ai/agreement-draft returns a hardcoded mockgenerateObject from the ai package is imported but never called. Every request gets title "AI Generated Agreement", amount "1000", and type "single" regardless of user input. That doesn't meet #16 (AI-guided draft from natural language).

Please address:

  1. Wire up real draft generation — use generateObject (or equivalent) with a configured provider + OPENAI_API_KEY (or similar) in .env.example; parse user input into title, amount, milestones, and use case.
  2. PR description: Closes #16 (GrantFox exact wording).
  3. Proof of completion — screenshots/recording: describe an agreement → meaningful draft → pre-fill wizard → user can edit.
  4. i18n — EN/ES for modal copy and "Create with AI" buttons.
  5. Lockfile — update pnpm-lock.yaml (we use pnpm), avoid large unrelated package-lock.json churn.
  6. Auth — protect the API route (JWT) before exposing a paid LLM endpoint.

Happy to re-review once the endpoint generates real structured drafts from user input. Thanks!

@ManuelJG1999

Copy link
Copy Markdown
Contributor

@DavisVT
Could you please check on our previous message?

Thank you.

@Kalchaqui

Copy link
Copy Markdown
Contributor

@DavisVT — still no new commits since the review on Jun 22 (c8d62cb). The mock endpoint blockers remain open. Please push an update with real LLM draft generation, Closes #16, proof, i18n, pnpm-lock.yaml, and JWT auth on the API route. Happy to re-review once pushed. Thanks!

@DavisVT

DavisVT commented Jun 29, 2026

Copy link
Copy Markdown
Author

@alright
sorry for the late response

@DavisVT

DavisVT commented Jun 29, 2026

Copy link
Copy Markdown
Author

"Removed package-lock.json from tracking and added to .gitignore. Only pnpm-lock.yaml will be used going forward. All 6 blockers addressed — ready for re-review."

@DavisVT

DavisVT commented Jun 29, 2026

Copy link
Copy Markdown
Author

Hi, trying to provide a screenshot need the .env template to test locally. Can you pls share the Supabase URL and anon key for local dev?
Thank you.

@ManuelJG1999

Copy link
Copy Markdown
Contributor

@DavisVT could you get the requested information?
Thank you

@Kalchaqui

Copy link
Copy Markdown
Contributor

Re-review — still not mergeable

Thanks @DavisVT for pushing past the mock endpoint. generateObject + JWT checks are a real step forward vs the Jun 22 review, but the feature still does not work end-to-end for #16.

Blockers

  1. Client ↔ API contract is broken

    • UI posts { userInput, useCases }.
    • Route reads { title, description, amount, milestones, useCase }.
    • Natural-language input never reaches the model as the issue describes. Align on one contract: accept free-text userInput (preferred for AI-Guided Agreement Creation Assistant #16) and let the model produce the full draft.
  2. Client never sends the JWT

    • Route requires Authorization: Bearer ….
    • AIAgreementAssistant fetch has no auth header → every call is 401.
    • Pass the token from the existing auth store / provider (same pattern as other /api/* calls).
  3. Broken import: @/lib/auth

    • verifyToken lives in @/lib/auth/utils (there is no lib/auth barrel on main).
    • This route will fail to compile / resolve unless that path is fixed.
  4. Missing / incomplete AI deps + env

    • Route imports @ai-sdk/openai, but package.json only adds ai — add @ai-sdk/openai (or use the Gateway model string from the issue).
    • Document OPENAI_API_KEY (or AI Gateway vars) in .env.example.
    • Prefer the issue’s Gateway model guidance if that is what Thalos wants in prod.
  5. .gitignore is deleted (entire file emptied)

    • The PR removes all ignore rules (node_modules, .next, .env*, etc.).
    • This must be restored immediately — do not merge with an empty .gitignore.
  6. Validation gaps vs acceptance criteria

    • No check that milestone amounts sum to amount.
    • No enforcement that milestones.length > 1agreement_type: "multi".
    • Risk-flag prompt is weak / not guaranteeing the minimum rules (missing amount, missing deliverable, lump-sum without release condition, deadline not captured).
  7. i18n incomplete

    • Personal uses t("dashPage.createWithAI")
    • Business still hardcodes Create with AI
    • Modal copy is English-only
    • ES string regressed: "Nueva Acuerdo" → should stay "Nuevo Acuerdo"
  8. Proof still missing

    • Screenshots/recording of: describe deal → structured draft → pre-fill wizard → edit → submit via existing form.
    • For local proof you do not need our private Supabase keys for the AI route alone — you need OPENAI_API_KEY (or Gateway) + a valid JWT from a local login. We will mot paste production secrets in the PR thread; use .env.example + your own project / staging credentials from the Telegram community if needed.

What improved

  • Real generateObject path (no hardcoded mock draft)
  • JWT guard on the route (conceptually correct once the client sends the token)
  • Entry points on both dashboards + draft → form pre-fill wiring
  • package-lock.json removed in favor of pnpm

Please also

  • Rebase onto current main (branch is stale vs recent FE merges)
  • Title the closing line exactly Closes #16

Happy to re-review once the request body + Bearer token + imports/deps + .gitignore restore are fixed and you attach proof.

@ManuelJG1999

Copy link
Copy Markdown
Contributor

@DavisVT could you please send us a DM so we can work on the pending actions?

https://t.me/ThalosOSSCommunity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

AI-Guided Agreement Creation Assistant

3 participants